package com.wyx.suanfa;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class getIntersectionNode {
    //给你两个单链表的头节点 headA 和 headB ，请你找出并返回两个单链表相交的起始节点。
    // 如果两个链表没有交点，返回 null 。
    public static void main(String[] args) {
        String str1 = "abc";
        String str2 = "abd";


    }
}

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) {
 *         val = x;
 *         next = null;
 *     }
 * }
 */
/*
public class Solution {

    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode curA = headA;
        ListNode curB = headB;
        int lenA = 0;
        int lenB = 0;
        //遍历两个链表，求出其各自长度
        while(curA != null){
            lenA++;
            curA = curA.next;
        }
        while(curB != null){
            lenB++;
            curB = curB.next;
        }

        curA = headA;
        curB = headB;

        //让curA为其中长的链表，lenA为其中长的链表的长度
        if(lenB > lenA){
            curA = headB;
            curB = headA;

            int tempLen = lenA;
            lenA = lenB;
            lenB = tempLen;
        }

        int count = lenA - lenB;
        for(int i = 0;i<count;i++){
            curA = curA.next;
        }

        while(curA != null){
            if(curA == curB){
                return curA;
            }
            curA = curA.next;
            curB = curB.next;
        }

        return null;


    }
}*/
